<?php
    include_once('src/classes/class.login.php');
    
    session_start();
    
    $login = new Login();
    
    if ($login->giveId() != 0)
    {   
     header('location: http://'.$_SERVER['HTTP_HOST'].'/'.$_SESSION['context'].'/panel.php?id='.$login->giveId());
    }
    
    $token = $_SESSION['token'] = md5(uniqid(mt_rand(),true));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=utf-8" http-equiv="content-type" />
    <title>RF Mantencion</title>
    <link rel="stylesheet" href="css/comtec.css" type="text/css" />
</head>
<body>
    <div id="contenedor">
	<div id="mainTitle"><h1>RF Mantenci&oacute;n</h1></div>
	<div id="login">
	    <form method="POST" name="loginForm" action="src/scripts/login.php" accept-charset="UTF-8">
		
		    <br />
                    <legend>Acceso</legend>
                    <br />
		    <table>
			<tr>
                            <td><img src="iconos/user.png" /> Usuario</td><td><input type="text" size="30" name="username" /></td>
			</tr>
			<tr>
                            <td><img src="iconos/password.png" /> Contrase&ntilde;a</td><td><input type="password" name="password" /></td>
			</tr>			
                        <tr><td><input type="submit" name="login" value="Ingresar" /></td><td><a href="src/scripts/recover_password.php" class="link">¿Olvid&oacute; su contrase&ntilde;a?</a></td></tr>
                        <tr>
			    <td>Recordar sesi&oacute;n <input id="remember" name="remember_me" value="1" type="checkbox" /></td>
			</tr>
		    </table>
		    <input type="hidden" name="token" value="<?=$token;?>" />	                     		
	    </form>
	</div>
    </div>
</body>
</html>
